<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <div id="app">
        <h1>计算属性示例</h1>
        <input type="number" v-model="num1" placeholder="输入第一个数字">
        <input type="number" v-model="num2" placeholder="输入第二个数字">
        <p>总和: {{ total() }}</p> <!-- 使用计算属性 -->
        <p>乘的结果: {{ result() }}</p>
    </div>

    <script src="./js/vue@3.js"></script>

    <script>
        const { createApp, ref } = Vue
        createApp({
            setup() {
                const num1 = ref(0);
                const num2 = ref(0);
                const total = () => {
                    return num1.value + num2.value;
                }
                const result = () => {
                    return num1.value * num2.value;
                }
                return {
                    num1,
                    num2,
                    total,
                    result
                };
            }
        }).mount("#app")
    </script>
</body>

</html>